import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
  state: {
    tabIndex: 0,
    indexPageSelected: 1,
    indexStarSelected: 2,
<<<<<<< HEAD
    indexCardSelected: -1
=======
    userAvatar: "https://picsum.photos/seed/avatar/100/100",
    sysInfo: {},
    navbarHeight: 46,
    tabbarHeight: 50
>>>>>>> dev
  },
  mutations: {
    login(state, provider) {
      state.hasLogin = true;
      state.loginProvider = provider;
    },
    changeTab(state, index) {
      state.tabIndex = index
    },
    changeIndexPageSelected(state, index) {
      state.indexPageSelected = index
    },
    changeIndexStarSelected(state, index) {
      state.indexStarSelected = index
<<<<<<< HEAD
    } ,
    changeIndexCardSelected(state, index) {
      state.indexCardSelected = index
=======
    },
    changeUserAvatar(state, avatar) {
      state.userAvatar = avatar
    },
    setSysInfo(state) {
      uni.getSystemInfo({
        success(res) {
          console.log(res)
          state.sysInfo = res
        }
      })
>>>>>>> dev
    }
  }
})

export default store